//
//  Message.h
//  Gabber
//
//  Created by 惠国 陆 on 11-10-10.
//  Copyright (c) 2011年 恒生聚源. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>


@interface Message : NSManagedObject

@property (nonatomic, retain) NSString * streamBareJidStr;
@property (nonatomic, retain) NSString * jidStr;
@property (nonatomic, retain) NSString * content;
@property (nonatomic, retain) NSNumber * outbound;
@property (nonatomic, retain) NSNumber * read;
@property (nonatomic, retain) NSDate * timestamp;

+ (id)insertInManagedObjectContext:(NSManagedObjectContext *)moc
                       withMessage:(XMPPMessage *)message
                  streamBareJidStr:(NSString *)streamBareJidStr;

- (void)updateWithMessage:(XMPPMessage *)message streamBareJidStr:(NSString *)streamBareJidStr;

- (BOOL)isOutbound;
- (void)setIsOutbound:(BOOL)flag;
- (BOOL)hasBeenRead;
- (void)setHasBeenRead:(BOOL)flag;

- (NSComparisonResult) timestampCompare:(Message *)msg;

@end
